package org.dromara.system.utils;

import jodd.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum CompanyCertFieldEnum {

    FIELD1("certificateId","证书编号"),
    FIELD3("certificateName","证书名称"),
    FIELD4("coverage","覆盖范围"),
    FIELD401("certifyingTime","认证日期"),
    FIELD5("certifyingEndTime","有效期至"),
    FIELD501("certifyingAgencies","认证机构");

    private final String field;
    private final String fieldName;

    public static CompanyCertFieldEnum findByFieldName(String fieldName) {
        if (StringUtil.isBlank(fieldName)) {
            return null;
        }
        for (CompanyCertFieldEnum type : values()) {
            if (type.fieldName.equals(fieldName.replaceAll("\\s*|\r|\n|\t",""))) {
                return type;
            }
        }
        return null;
    }

}
